<?php

if(!defined('PATH')) exit();

class News extends Controller {

	protected $default_action = 'view';

	public $_title = 'News';

	public function __construct() {
		parent::__construct();
	}

	public function action_view() {
		$view = new View('news/index');
		$newsList = new Model_NewsList();
		$newsList->load(10, 0); //*todo* pagination
		$view->newsList = $newsList;
		$view->render();
	}

	public function action_comments() {
		if (empty($this->paramsURI[2]))
			header('Location: ' . PATH . '/news/'.$this->default_action);
		$view = new View('news/view');
		$news = new Model_News();
		$news->load($this->paramsURI[2]);
		$view->news = $news;
		$commentList = new Model_CommentList();
		$commentList->load($news->id);
		$view->commentList = $commentList;
		$view->render();
	}

	public function action_add_comment() {
		//*todo*
	}
	
	public function action_edit_comment() {
		
	}
	
	public function action_delete_comment() {
		
	}

	public function action_add_news() {

	}

	public function action_edit_news() {

	}

	public function action_delete_news() {

	}
}
?>